<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2016/9/9
 * Time: 15:35
 */
if (!defined('ACCESS')) {
    exit('Access denied.');
}

class AdminPayConfig extends Base
{

    private static $table_name = 'pay_configuration';
    // 查询字段
    private static $columns = array('id', 'app_site', 'app_name', 'merchant_id', 'tran_num', 'app_key', 'note', 'api_url', 'createtime');

    public static function getTableName()
    {
        return self::$table_name;
    }

    public static function getInfo($name)
    {
        $db = self::__instance();
//        $condition = array("app_site" => $name);
//        var_dump($condition);exit;
//        $list = $db->get(self::getTableName(), self::$columns, $condition);
        $sql = "select * from " . self::getTableName() . " where `app_site`= '$name'";
        $row = $db->query($sql)->fetch();
        return $row;
    }

    public static function getAll()
    {
        $db = self::__instance();
        $list = $db->select(self::getTableName(), self::$columns);
        return $list;
    }

    public static function update($id, $data)
    {
        $condition = array('id' => $id);
        $db = self::__instance();
        $rt = $db->update(self::getTableName(), $data, $condition);
        return $rt;
    }

    public static function add($data)
    {
        $db = self::__instance();
        $rt = $db->insert(self::getTableName(), $data);
        return $rt;
    }
}




